package com.shop.dingdongshoppingapi.controller;

import com.shop.dingdongshoppingapi.config.SystemConfig;
import com.shop.dingdongshoppingapi.service.intf.SearchInfoService;
import com.shop.dingdongshoppingapi.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("api/dd")
@Api(tags = "实现搜索记录查询")
@CrossOrigin
public class SearchInfoController {
    @Autowired
    private SearchInfoService service;
    @ApiOperation(value = "查询")
    @GetMapping("/select.do")
    public R select( HttpServletRequest request){
        System.out.println(request.getIntHeader(SystemConfig.TOKEN_HEADER));
        return service.select(request.getIntHeader(SystemConfig.TOKEN_HEADER));
    }
    @ApiOperation(value = "查询最后一条")
    @GetMapping("/selectLast.do")
    public R selectLast(HttpServletRequest request){
        return service.selectLast(request.getIntHeader(SystemConfig.TOKEN_HEADER));
    }
}
